const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    design_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "设计图ID",
      field: "design_id"
    },
    user_id: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "用户ID",
      field: "user_id",
      references: {
        key: "user_id",
        model: "user_model"
      }
    },
    design_name: {
      type: DataTypes.STRING(50),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "设计图名称",
      field: "design_name"
    },
    design_date: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "设计时间",
      field: "design_date"
    },
    design_src: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "设计图存储src",
      field: "design_src"
    }
  };
  const options = {
    tableName: "my_design",
    comment: "",
    indexes: [{
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }]
  };
  const MyDesignModel = sequelize.define("my_design_model", attributes, options);
  return MyDesignModel;
};